Weird behaviour of a generator function while converting it to a list